﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Dom</title>
		<script src="../../py/system.js" type="text/javascript"></script>
		<script src="../../py/system/dom/element.js" type="text/javascript"></script>
		
		<script src="../../common/project/project.js" type="text/javascript"></script>
		<script src="../../common/assets/scripts/default.js" type="text/javascript"></script>
		<script src="../../common/assets/scripts/debug.js" type="text/javascript"></script>
	</head>
	<body> 
		<div style="background: yellow;" id="a" class="a b">
				<div style="background: red; width:200px;" id="aa">id=aa<div style="background: black; color:white" id="aba">id=aba</div></div>
				<div style="background: green;" id="ab">id=ab<input type="button" name="button" id="button" value="子控件" /></div>
			</div>
			<hr>
		<script>
			var a = $('a'), aa = $('aa'), aba = $('aba'), ab = $('ab');
			var fns = [
				'create',
				["Element.parse",function(){   return Element.parse("<div>aaa</div>");}],
				["document.create", function(){
					var dom = document.create("div",    "xxx");
					dom.appendChild(document.create("ul", "xxx"));
					return dom;
				}],
				'gets',
				["Element.prototype.getElementsByClassName", function(){ return a.getElementsByClassName('d'); }],
				["Element.prototype.getElementsByAttribute", function(){ return a.getElementsByAttribute('id', 'ab'); }],
				["Element.prototype.find", function(){ return aa.find('div'); }],
				["Element.prototype.findAll", function(){ return aa.findAll('div'); }],
				'node',
				["Element.prototype.append", function(){ return a.append('asdasdasdasda'); }],
				["Element.prototype.insert", function(){ return a.insert('asd', 'beforeEnd'); }],
				["Element.prototype.clone", function(){ return a.clone(); }],
				["Element.prototype.wrapWith", function(){ return a.wrapWith("<i></i>"); }],
				["Element.prototype.replaceWith", function(){ return aa.replaceWith(ab); }],
				'get',
				["Element.prototype.get('previous')", function(){ return a.get('previous'); }],
				["Element.prototype.get('next')", function(){ return a.get('next'); }],
				["Element.prototype.get('first')", function(){ return a.get('first'); }],
				["Element.prototype.get('last')", function(){ return a.get('last'); }],
				["Element.prototype.get('child')", function(){ return a.get('child').doms; }],
				["Element.prototype.get('parent')", function(){ return a.get('parent'); }],
				["Element.prototype.get('siblings')", function(){ return a.get('siblings').doms; }],
				["Element.prototype.get('previouses')", function(){ return a.get('previouses').doms; }],
				["Element.prototype.get('nexts')", function(){ return a.get('nexts').doms; }],
				["Element.prototype.get('parents')", function(){ return a.get('parents').doms; }],
				["Element.prototype.get('children')", function(){ return a.get('children').doms; }],
				["Element.prototype.get('child')", function(){ return aa.get('child').doms; }],
				'move',
				["Element.prototype.renderTo", function(){ return a.renderTo(document.body); }],
				["Element.prototype.contains", function(){ return a.contains(ab); }],
				["Element.prototype.remove", function(){ return a.remove(ab); }],
				["Element.prototype.empty", function(){ return a.empty(); }],
				["Element.prototype.dispose", function(){ return a.dispose(); }]
			];
		</script>
	</body>
</html>
